/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session;

import entity.JobDetails;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author owtee
 */
@Stateless
public class JobDetailsFacade extends AbstractFacade<JobDetails> {

    @PersistenceContext(unitName = "MSGPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public JobDetailsFacade() {
        super(JobDetails.class);
    }

    public List<JobDetails> findByJobId(String jobId) {
        em.getEntityManagerFactory().getCache().evictAll();
        return em.createQuery("SELECT j FROM JobDetails j WHERE j.jobId.jobId = :jobId")
                .setParameter("jobId", jobId)
                .getResultList();
    }
}
